﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreWebApi3.Models;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace CoreWebApi3.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class JwtController : ControllerBase
    {
        /// <summary>
        /// 获取令牌
        /// </summary>
        /// <param name="ID">ID</param>
        /// <param name="name">账号</param>
        /// <returns></returns>
        [HttpPost]
        public string GetJwt(int ID, string name)
        {
            TokenModel tokenModel = new TokenModel
            {
                ID = ID,
                Name = name
            };

            return TokenHelper.GetJWT(tokenModel);
        }
    }
}